/*    */ package com.zimbra.cs.index;
/*    */ 
/*    */ import com.google.common.base.Objects;
/*    */ import com.google.common.base.Objects.ToStringHelper;
/*    */ import com.google.common.collect.Lists;
/*    */ import java.util.List;
/*    */ import org.apache.lucene.search.ScoreDoc;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class ZimbraScoreDoc
/*    */ {
/*    */   private final ZimbraIndexDocumentID documentID;
/*    */   private final float score;
/*    */   
/*    */   private ZimbraScoreDoc(ZimbraIndexDocumentID documentID, float score)
/*    */   {
/* 34 */     this.documentID = documentID;
/* 35 */     this.score = score;
/*    */   }
/*    */   
/*    */   public static ZimbraScoreDoc create(ZimbraIndexDocumentID documentID, float score) {
/* 39 */     return new ZimbraScoreDoc(documentID, score);
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public static ZimbraScoreDoc create(ZimbraIndexDocumentID documentID)
/*    */   {
/* 46 */     return new ZimbraScoreDoc(documentID, NaN.0F);
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public static ZimbraScoreDoc create(ScoreDoc luceneScoreDoc)
/*    */   {
/* 53 */     return new ZimbraScoreDoc(new ZimbraLuceneDocumentID(luceneScoreDoc.doc), luceneScoreDoc.score);
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public ZimbraIndexDocumentID getDocumentID()
/*    */   {
/* 60 */     return this.documentID;
/*    */   }
/*    */   
/*    */ 
/*    */ 
/*    */   public float getScore()
/*    */   {
/* 67 */     return this.score;
/*    */   }
/*    */   
/*    */   public static List<ZimbraScoreDoc> listFromLuceneScoreDocs(ScoreDoc[] luceneScoreDocs) {
/* 71 */     if (luceneScoreDocs == null) {
/* 72 */       return Lists.newArrayListWithCapacity(0);
/*    */     }
/* 74 */     List<ZimbraScoreDoc> docs = Lists.newArrayListWithCapacity(luceneScoreDocs.length);
/* 75 */     for (ScoreDoc luceneDoc : luceneScoreDocs) {
/* 76 */       docs.add(create(luceneDoc));
/*    */     }
/* 78 */     return docs;
/*    */   }
/*    */   
/*    */   public String toString()
/*    */   {
/* 83 */     return Objects.toStringHelper(this).add("documentID", this.documentID).add("score", this.score).toString();
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/index/ZimbraScoreDoc.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */